package com.android.telephonecall.utils;

import android.content.Context;
import android.graphics.Point;
import android.os.Build;
import android.os.SystemClock;
import android.provider.Settings;
import android.util.Log;

/**
 * 设备信息管理
 */
public class DeviceInfoManager {

    private static final String TAG = "DeviceManager";

    private static DeviceInfoManager sInstance;

    public static DeviceInfoManager getInstance() {
        if (sInstance == null) {
            synchronized (DeviceInfoManager.class) {
                if (sInstance == null) {
                    sInstance = new DeviceInfoManager();
                }
            }
        }

        return sInstance;
    }

    private String mDeviceId;                   // 设备ID

    private String mPhoneModel;                 // 手机型号

    private String mAppVersion;                 // APP版本

    private String mAndroidVersion;             // 安卓版本

    private String mPhoneList;                  // 手机号

    private DeviceInfoManager() {
    }

    /**
     * 初始化设备信息
     */
    public void initDeviceInfo(Context context) {
        //设备ID
        mDeviceId = Settings.Secure.getString(AppDelegate.getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
        //手机型号
        mPhoneModel = Build.MODEL;
        //APP版本
        mAppVersion = AndroidUtils.getAppVersion(AppDelegate.getContext());
        //安卓版本
        mAndroidVersion = android.os.Build.VERSION.RELEASE;

        Log.d(TAG, "initDeviceInfo mDeviceId: " + mDeviceId + " mPhoneModel:" + mPhoneModel
                + " mAppVersion:" + mAppVersion + " mAndroidVersion:" + mAndroidVersion);
    }

    public String getDeviceId() {
        return mDeviceId;
    }

    public String getPhoneModel() {
        return mPhoneModel;
    }

    public String getAppVersion() {
        return mAppVersion;
    }

    public String getAndroidVersion() {
        return mAndroidVersion;
    }

    public String getPhoneList() {
        return mPhoneList;
    }
}
